<?php $this->load->view('common/pagehead')?>
<?php $this->load->view('common/header')?>
      <div class="left w290"><!-- 290 div start -->
             <!--Current Deal-->
    		 <div class="bg-left ptb" style="border-radius:3px;">
              <div class="lftbx">Current Top Deal</div>
            	<div style="padding:15px 0 0 0;">
                   <div class="left" style="padding:10px -20px 0 0;"><img src="/public/images/tag-edge.png" style="margin-left:-26px;position:absolute;"/></div>
                   <div id="bg_btn" style="text-align:center;">
                   	<a href="./<?php if(isset($topDealsArray[0]['deals_url'])){ echo urlencode($topDealsArray[0]['deals_url']);}else{ echo $topDealsArray[0]['store_url'].'-deals';}?>" style="font-size:18px; color:#fff;line-height:33px;text-decoration:none;">Grab It Now</a>
                   </div>
                </div>
            	<div class="clr-both"></div>
               <div class="lftbx" style="padding-bottom:10px;line-height:26px;"><?php echo $topDealsArray[0]['deals_name'];?></div>
                <hr width="230px"/>
               <div class="lftbx">Deals Lasts For</div>
               <div class="tmelps" style="padding:15px 15px;text-align:center;">
               <?php
					$startdate=date('Y-m-d H:i:s'); 
					$enddate=$topDealsArray[0]['deals_expiredate']; 
					$diff=strtotime($enddate)-strtotime($startdate); //diff in sec
					$temp=$diff/86400; //convert to days - 60 sec/min*60 min/hr*24 hr/day=86400 sec/day 
					$days=floor($temp); $temp=24*($temp-$days); //days
					$hours=floor($temp);$temp=60*($temp-$hours); // hours 
					$minutes=floor($temp);$temp=60*($temp-$minutes); // minutes 
					$seconds=floor($temp);// seconds 
					if($days>0) echo $days.':';
					echo $hours.':'.$minutes.':'.$seconds;
			 ?></div>
             <!--Current Deal-->
             </div>
             <div class="mt10">
              <div class="clr-both"></div>
          	  <!--Top Deals Today-->
          	     <div style="background-color:#F2F1F1; padding-top:15px; border-radius:3px 3px 3px 3px;">
                    <div style=" background-color:#64AB23; overflow:hidden; margin-top:10px; height:40px; border-radius:3px 3px 3px 3px;">
                       <div class="txtwht1" style="margin:12px 0 0 20px; font-weight:bold;">Top Deals Today</div>
                    </div>
                    <!--Deals Left-->
                    <?php if(!empty($topDealsArray)){for($i=1;$i<=10;$i++){
                    if(isset($topDealsArray[$i]['deals_name'])){?>
                    <div class="p15" style="margin:10px 10px 0 10px;">
                    	<div class="ofrtxt"><?php echo $topDealsArray[$i]['deals_name'];?></div>
                        <p style="text-align:justify"><?php echo $topDealsArray[$i]['deals_description'];?></p>
                          <div style="margin-top:5px;">
                        	<div class="left">
                            	<div class="bg_img" style="width:92px; height:27px;"><div style="font-size:12px; font-weight:bold; color:#FFF; padding:5px 0 0 30px;">Rs.<?php echo ($topDealsArray[$i]['deals_price']*$topDealsArray[$i]['deals_saving'])/100;?></div></div>
                            	<div class="bg_img_blu"><span class="sml_txt_wht" style="padding-left:10px;">Instead Of</span><br/><span class="sml_txt_wht" style="padding-left:16px;"><?php echo $topDealsArray[$i]['deals_price'];?></span></div>
                               
                            </div>
                            <!--offer image-->
                            <div class="left"><img src="<?php if(isset($topDealsArray[$i]['deals_image']) && $topDealsArray[$i]['deals_image']!=''){
           		 		if(file_exists($topDealsArray[$i]['deals_image'])){?>
           		 			/public/images/Item1.png
           		 	<?php }else{
           		 		echo '/public/images/Item1.png';
           		 	}}else{ echo '/public/images/Item1.png';}?>"  style="padding:0 0 0 20px;width:100px;height:60px;"/></div>
                            <!--offer image-->
   							<a href="./<?php if(isset($topDealsArray[$i]['deals_url'])){ echo urlencode($topDealsArray[$i]['deals_url']);}else{ echo $topDealsArray[$i]['store_url'].'-deals';}?>" style="text-decoration:none;">
   								<input type="button" value="View" style="border: 1px solid #777777; background: #6e9e2d; color: white; font: bold 11px 'Trebuchet MS'; padding: 4px; cursor: pointer; -moz-border-radius: 4px; -webkit-border-radius: 4px; width:200px; margin:10px 0 0 10px;" />
   							</a>
                            <div class="clr-both"></div>
                          </div>
                    </div>
                    <div class="clr-both"></div>
                    <?php }else{ continue;}}}else{ echo 'NO Deals To Display..';}?>
                    <div><a href="#" class="right" style="color:#254B7C;font-size:14px;line-height:30px;text-decoration:none;margin-right:10px;">View All</a></div>
                    <div class="clr-both spacer-10"></div>
                 </div>
          	  <div class="clr-both"></div>
          	  <!--Top Deals Today-->
          	  <div class="spacer-10"></div>
          	  <!-- banner starts -->
          	  <div style="background-color:#F2F1F1; padding:10px; border-radius:3px 3px 3px 3px;">
          	  	<a href="<?php if(isset($banner250[0]['banner_link'])){ echo $banner250[0]['banner_link'];}?>" target="_blank" rel="nofollow"><img src="<?php if(isset($banner250[0]['banner_image'])){ echo $banner250[0]['banner_image'];}?>" alt="<?php if(isset($banner250[0]['banner_alt'])){ echo $banner250[0]['banner_alt'];}?>" width="240" border="0" /></a>
          	  </div>
          	  <!-- banner starts -->
             </div>
             <div class="spacer-10"></div>
      </div>         
     <!-- 290 div end -->
      
      <div class="right w700"><!-- 700 div starts-->
      <!--Slider Strts Here-->
        <div style="border:thin">

        <!-- BEGINNING OF THE CODE FOR THE CSS-3-SLIDESHOW-->
        <!----------------------------------------->
        <!-- STYLE-CONFIGURATION STARTS HERE -->
        <!----------------------------------------->
        <!-- Set the text-style within .textboxstyle -->
        <!-- Set the backgroundcolor, the rounded corners and the shadow within .textboxbackgroundstyle -->
        <!-- Set the rounded corners and the shadow within .curveandshadowstyle -->
        <!----------------------------------------->
        <!-- STYLE-CONFIGURATION STOPS HERE -->
        <!----------------------------------------->
    
        <script>
        
        var imgurl= new Array()
        var message= new Array()
        var thislink= new Array()
        
        /////////////////////////////////////////////////
        // SCRIPT-CONFIGURATION STARTS HERE
        /////////////////////////////////////////////////
        
        // set the url (or path)  of your images. Add as many images as you like
        <?php foreach($homeBanner as $temp => $values){?>
        imgurl[<?php echo $temp;?>]=".<?php echo $values['home_banner_image'];?>"
        <?php }?>
        
        // set the messages corresponding to the images above (no more no less than the images above)
        <?php foreach($homeBanner as $temp => $values){?>
        message[<?php echo $temp;?>]="<?php echo $values['home_banner_title'];?>"
        <?php }?>
        
        // set the links corresponding to the images above (no more no less than the images above)
        // If you dont want to add a link enter a #"instead of http://www.mylink.com, see smaple below
        <?php foreach($homeBanner as $temp => $values){?>
        thislink[<?php echo $temp;?>]="./<?php echo $values['store_url'];?>-deals"
        <?php }?>
        
        // width of pictures (pixel)
        var imgwidth=700
        
        // width of pictures (pixel)
        var imgheight=200
        
        // set stillstand of picture (seconds)
        var stillstand=3.5
        
        // set opacity-strength (transparency-effect). Values may range from 1 to 100
        var opacitystrength=60
        
        /////////////////////////////////////////////////
        // SCRIPT-CONFIGURATION STOPS HERE
        /////////////////////////////////////////////////
        
        
        // Do not edit below this line
        var tmr
        var step=10
        var i=imgwidth
        var i_imgurl=0
        stillstand*=1000
        
        var preloadedimages=new Array()
        for (iii=0;iii<imgurl.length;iii++){
            preloadedimages[iii]=new Image()
            preloadedimages[iii].src=imgurl[iii]
        }
        
        function shrinkpic() {
            document.getElementById("textbox").innerHTML=""
            if (i>0) {
                i-=step
                document.getElementById("picdiv").style.width=i+"px"
                document.getElementById("picdiv").style.height=i*(imgheight/imgwidth)+"px"
                document.getElementById("picdiv").style.left=imgwidth/2-(i/2)+"px"
                document.getElementById("picdiv").style.top=(imgwidth/2-(i/2))*(imgheight/imgwidth)+"px"
                tmr=setTimeout("shrinkpic()",20)
            }
            else {
                i_imgurl++
                if (i_imgurl>=imgurl.length) {
                    i_imgurl=0
                }
                document.getElementById("picdiv").style.background="url("+imgurl[i_imgurl]+")"
                i=1
                tmr=setTimeout("enlargepic()",20)
            }
        }
        
        function enlargepic() {
            if (i<=imgwidth) {
                i+=step
                document.getElementById("picdiv").style.width=i+"px"
                document.getElementById("picdiv").style.height=i*(imgheight/imgwidth)+"px"
                document.getElementById("picdiv").style.left=imgwidth/2-(i/2)+"px"
                document.getElementById("picdiv").style.top=(imgwidth/2-(i/2))*(imgheight/imgwidth)+"px"
                tmr=setTimeout("enlargepic()",20)
            }
            else {
                i=imgwidth
                showmessage()
            }
        }
        
        function showmessage() {
            document.getElementById("textbox").innerHTML='<span class="textboxbackgroundstyle">'+message[i_imgurl]+'</span>'
            tmr=setTimeout("shrinkpic()",stillstand)
        }
        
        function gotothislink(){
            document.location.href=thislink[i_imgurl]
        
        }
        
        document.write('<div id="roof" style="position:relative;width:'+imgwidth+'px;height:'+imgheight+'px;">')
        document.write('<div id="picdiv" class="curveandshadowstyle" style="position:absolute;background:url('+imgurl[0]+');width:'+imgwidth+'px;height:'+imgheight+'px;top:0px;left:0px;"></div>')
        
        document.write('<div id="tt" onClick="gotothislink()" style="position:absolute;width:'+imgwidth+'px;height:'+imgheight+'px;top:0px;left:0px;filter:alpha(opacity='+opacitystrength+');opacity:'+(opacitystrength/100)+';cursor:pointer;"><table width='+imgwidth+' height='+imgheight+'><tr><td id="textbox" class="textboxstyle"><span class="textboxbackgroundstyle">'+message[0]+'</span></td></tr></table></div>')
        
        document.write('</div>')
        
        window.onload=shrinkpic
        </script>
        <!-- END OF THE CODE FOR THE CSS-3-SLIDESHOW-->
        </div>
        <!--Slider Ends Here-->
        <div class="clr-both"></div>
        <!--Deals Navigation-->
        <div class="spacer-10"></div>
        <div id="navdl">
            <ul style="padding:20px 0 0 5px;">
                <li class="txtwht1">Showing <?php echo count($featuredDealsArray);?> Of <?php echo count($countArray);?> Deals</li>
            </ul> 
            <!--DropDown
            <div class="ddlWrap left" style="margin:-10px 0 10px 10px;">
                <span>--Sort By--</span>
                <select id="ddlCountry">
                    <option value=""> --- Choose ---</option>
                    <option value="Popularity">Popularity</option>
                    <option value="Deals">Deals</option>
                    <option value="Offers">Offers</option>
                    <option value="Latest Deal">Latest Deal</option>
                </select>
            </div>
          DropDown--> 
                         <!--Grid View List View-->
                             <div class="right" style="margin:-10px 10px 0 0;">
                                <!-- <div class="left" style="">
                                    <a href="#"><img src="/public/images/grid_vw.png" /></a>
                                </div>-->
                                <div  class="right" style="margin-left:10px">
                                    <a href="./"><img src="/public/images/list_vw.png" /></a>
                                </div>
                             </div>
                         <!--Grid View List View-->
          </div>
         <!--Deals Navigation-->
         <div class="spacer-10"></div>
         <!--right side deals-->
         <?php foreach($featuredDealsArray as $temp){?>
            <div class="deal_bg">
               <div class="left">
           		 <div class="image">
           		 	<img src="
           		 	<?php if(isset($temp['deals_image']) && $temp['deals_image']!=''){
           		 		if(file_exists($temp['deals_image'])){?>
           		 			/public/images/Item1.png
           		 	<?php }else{
           		 		echo '/public/images/Item1.png';
           		 	}}else{ echo '/public/images/Item1.png';}?>"/> 
           		 	<a href="/<?php if(isset($temp['deals_url']) && $temp['deals_url']!=''){ echo urlencode($temp['deals_url']);}?>">
           		 		<img src="/public/images/hover-img.png" class="hoverimage" border="0" />
           		 	</a>
           		 </div>
               </div>
               <div class="right" style="width:460px;">
            	 <div style="padding-top:10px; padding-left:10px;" class="dltxt1"><a href="./<?php if(isset($temp['deals_url']) && $temp['deals_url']!=''){ echo urlencode($temp['deals_url']);}else{ echo $temp['store_url'].'-deals';}?>" style="text-decoration:none;color:#254B7C;line-height:24px;"/><?php echo ucfirst($temp['deals_name']);?></a></div>
                 <p style="margin:5px 10px 5px 10px; text-align:justify;"><?php echo $temp['deals_description'];?></p>
                  <div class="clr-both"></div>
                 <div class="txtgry left">Savings : <span class="txtoffr"><?php echo $temp['deals_saving'];?>%</span></div>
                 <div class="right" style="margin:7px 15px 0 0;">
                 	<div class="left" style="font-size:18px;line-height:28px;">Deal Found On : </div>
                 	<div class="left" style="margin:5px 0 0 5px;">
                 		<a href="/deals/<?php echo $temp['store_url'];?>">
                 		<img src="
                 		<?php if(isset($temp['store_image']) && $temp['store_image']!=''){
           		 		if(file_exists($temp['store_image'])){
           		 			echo $temp['store_image'];
           		 			?>
           		 	<?php }else{
           		 		echo '/public/images/jabong.png';
           		 	}}else{ echo '/public/images/jabong.png';}?>" width="142" height="28" border="0"/>
           		 	</a> 
                 	</div>
                 </div>
               </div>
            </div>
             <div class="spacer-10"></div>
             <div class="clr-both"></div>
             <?php }?>
          <div id="navdl2">
            <ul style="padding:20px 0 0 170px;">
                <li class="txtwht1"><a href="javascript:void(0);" style="color:#fff;text-decoration:none;" onclick="showMore(<?php echo count($featuredDealsArray);?>);">Show More Deals( <?php echo count($countArray)-count($featuredDealsArray);?> ) To Go</a></li>
            </ul>      
            </div>
            <div class="spacer-10"></div>
         <!--right side deals-->
      </div><!-- 700 div ends -->
      <div class="clr-both"></div>
<?php $this->load->view('common/footer')?>
